VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicARSalesOrder 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Sample"
   ClientHeight    =   7920
   ClientLeft      =   -90
   ClientTop       =   465
   ClientWidth     =   11535
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmBasicARSalesOrder.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   7920
   ScaleWidth      =   11535
   ShowInTaskbar   =   0   'False
   Begin ITGControls.ITGTab SSTab1 
      Height          =   4110
      Left            =   30
      TabIndex        =   23
      Top             =   30
      Width           =   11445
      _ExtentX        =   20188
      _ExtentY        =   7250
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabStyle        =   1
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      ActiveTabForeColor=   0
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   -2147483633
      DisabledTabForeColor=   -2147483627
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   3795
         Left            =   -75000
         TabIndex        =   37
         Top             =   315
         Width           =   11445
         _ExtentX        =   20188
         _ExtentY        =   6694
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   7
         BeginProperty Column00 
            DataField       =   "cSONo"
            Caption         =   "Order No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cCode"
            Caption         =   "Client"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cSMan"
            Caption         =   "Salesman"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "cCPONo"
            Caption         =   "Customer PO #"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cRemarks"
            Caption         =   "Remarks"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "nNet"
            Caption         =   "Net Total"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   2
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1349.858
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   1275.024
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1049.953
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1110.047
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
               ColumnWidth     =   1335.118
            EndProperty
            BeginProperty Column05 
               Locked          =   -1  'True
               ColumnWidth     =   1560.189
            EndProperty
            BeginProperty Column06 
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   3795
         Left            =   0
         Top             =   315
         Width           =   11445
         _ExtentX        =   20188
         _ExtentY        =   6694
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Order Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   10995
            Top             =   2925
         End
         Begin VB.ComboBox cboType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmBasicARSalesOrder.frx":0CCA
            Left            =   9480
            List            =   "frmBasicARSalesOrder.frx":0CDD
            Style           =   2  'Dropdown List
            TabIndex        =   2
            Top             =   540
            Width           =   1500
         End
         Begin ITGControls.ITGTab SSTab2 
            Height          =   2715
            Left            =   0
            TabIndex        =   24
            Top             =   1080
            Width           =   11445
            _ExtentX        =   20188
            _ExtentY        =   4789
            TabCaption(0)   =   "Customer Details"
            TabContCtrlCnt(0)=   28
            Tab(0)ContCtrlCap(1)=   "dtbDeliveryDate"
            Tab(0)ContCtrlCap(2)=   "txtTotalAmount"
            Tab(0)ContCtrlCap(3)=   "txtVatRATE"
            Tab(0)ContCtrlCap(4)=   "chkVATType"
            Tab(0)ContCtrlCap(5)=   "cboIntTerms"
            Tab(0)ContCtrlCap(6)=   "cboTerms"
            Tab(0)ContCtrlCap(7)=   "cboPaymentType"
            Tab(0)ContCtrlCap(8)=   "cboTaxtype"
            Tab(0)ContCtrlCap(9)=   "txtVatAmount"
            Tab(0)ContCtrlCap(10)=   "txtTaxtype"
            Tab(0)ContCtrlCap(11)=   "txtNet"
            Tab(0)ContCtrlCap(12)=   "cmdPickSM"
            Tab(0)ContCtrlCap(13)=   "cmdPickCode"
            Tab(0)ContCtrlCap(14)=   "txtTerms"
            Tab(0)ContCtrlCap(15)=   "txtPaymentType"
            Tab(0)ContCtrlCap(16)=   "txtIntTerms"
            Tab(0)ContCtrlCap(17)=   "txtCode"
            Tab(0)ContCtrlCap(18)=   "txtAddress"
            Tab(0)ContCtrlCap(19)=   "txtContact"
            Tab(0)ContCtrlCap(20)=   "txtName"
            Tab(0)ContCtrlCap(21)=   "txtSMName"
            Tab(0)ContCtrlCap(22)=   "txtSMCode"
            Tab(0)ContCtrlCap(23)=   "Label7"
            Tab(0)ContCtrlCap(24)=   "Label41"
            Tab(0)ContCtrlCap(25)=   "Label2"
            Tab(0)ContCtrlCap(26)=   "Label3"
            Tab(0)ContCtrlCap(27)=   "Label5"
            Tab(0)ContCtrlCap(28)=   "lblStatus"
            TabCaption(1)   =   "Other Information"
            TabContCtrlCnt(1)=   11
            Tab(1)ContCtrlCap(1)=   "txtCurrencyRate"
            Tab(1)ContCtrlCap(2)=   "cmdPickMS"
            Tab(1)ContCtrlCap(3)=   "cboCurrency"
            Tab(1)ContCtrlCap(4)=   "txtMSCode"
            Tab(1)ContCtrlCap(5)=   "txtMSDesc"
            Tab(1)ContCtrlCap(6)=   "dtgExpiration"
            Tab(1)ContCtrlCap(7)=   "txtCurrency"
            Tab(1)ContCtrlCap(8)=   "txtCPONo"
            Tab(1)ContCtrlCap(9)=   "txtRemarks"
            Tab(1)ContCtrlCap(10)=   "Label6"
            Tab(1)ContCtrlCap(11)=   "Label1"
            TabCaption(2)   =   "Delivery Details"
            TabContCtrlCnt(2)=   8
            Tab(2)ContCtrlCap(1)=   "cmdPickDelCode"
            Tab(2)ContCtrlCap(2)=   "txtDelName"
            Tab(2)ContCtrlCap(3)=   "txtDelCode"
            Tab(2)ContCtrlCap(4)=   "txtDelAddress"
            Tab(2)ContCtrlCap(5)=   "txtDelContact"
            Tab(2)ContCtrlCap(6)=   "txtFax"
            Tab(2)ContCtrlCap(7)=   "txtEMail1"
            Tab(2)ContCtrlCap(8)=   "txtPhone1"
            TabTheme        =   2
            ActiveTabBackStartColor=   16250865
            ActiveTabBackEndColor=   16243138
            InActiveTabBackStartColor=   16243138
            InActiveTabBackEndColor=   16243138
            ActiveTabForeColor=   0
            InActiveTabForeColor=   0
            BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            OuterBorderColor=   4210752
            TopLeftInnerBorderColor=   4210752
            BottomRightInnerBorderColor=   4210752
            DisabledTabBackColor=   16243138
            DisabledTabForeColor=   -2147483627
            HoverColorInverted=   4210752
            Begin ITGControls.ITGDateBox dtbDeliveryDate 
               Height          =   285
               Left            =   8805
               TabIndex        =   57
               Tag             =   "Order Date"
               Top             =   2310
               Width           =   1650
               _ExtentX        =   2910
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   ""
               SendKeysTab     =   -1  'True
               Mandatory       =   -1  'True
            End
            Begin ITGControls.ITGTextBox txtTotalAmount 
               Height          =   285
               Left            =   7320
               TabIndex        =   55
               TabStop         =   0   'False
               Top             =   1410
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               DecimalPlace    =   2
               Locked          =   -1  'True
               Label           =   "Gross Amount"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1450
               TextBoxWidth    =   1655
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtVatRATE 
               Height          =   285
               Left            =   3285
               TabIndex        =   54
               TabStop         =   0   'False
               Top             =   1710
               Width           =   2130
               _ExtentX        =   3545
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               DecimalPlace    =   2
               Locked          =   -1  'True
               Label           =   "VAT Rate"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1040
               TextBoxWidth    =   1030
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGCheckBox chkVATType 
               Height          =   300
               Left            =   5520
               TabIndex        =   53
               Top             =   1710
               Width           =   1500
               _ExtentX        =   2646
               _ExtentY        =   529
               BackColor       =   16243138
               Caption         =   "VAT Inclusive"
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
            End
            Begin VB.ComboBox cboIntTerms 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               Left            =   8805
               Style           =   2  'Dropdown List
               TabIndex        =   48
               Top             =   510
               Width           =   1665
            End
            Begin VB.ComboBox cboTerms 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               Left            =   8805
               Style           =   2  'Dropdown List
               TabIndex        =   47
               Top             =   810
               Width           =   1665
            End
            Begin VB.ComboBox cboPaymentType 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               ItemData        =   "frmBasicARSalesOrder.frx":0D1E
               Left            =   8805
               List            =   "frmBasicARSalesOrder.frx":0D20
               Style           =   2  'Dropdown List
               TabIndex        =   46
               Top             =   1110
               Width           =   1665
            End
            Begin VB.ComboBox cboTaxtype 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               ItemData        =   "frmBasicARSalesOrder.frx":0D22
               Left            =   1515
               List            =   "frmBasicARSalesOrder.frx":0D24
               Style           =   2  'Dropdown List
               TabIndex        =   45
               Top             =   1710
               Width           =   1515
            End
            Begin ITGControls.ITGTextBox txtVatAmount 
               Height          =   285
               Left            =   7305
               TabIndex        =   44
               TabStop         =   0   'False
               Top             =   1710
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               DecimalPlace    =   2
               Label           =   "VAT Amount"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1450
               TextBoxWidth    =   1655
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtTaxtype 
               Height          =   285
               Left            =   1530
               TabIndex        =   43
               Tag             =   "cboPayment"
               Top             =   1725
               Visible         =   0   'False
               Width           =   1155
               _ExtentX        =   1931
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Payment Type"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   1095
            End
            Begin ITGControls.ITGTextBox txtNet 
               Height          =   285
               Left            =   7305
               TabIndex        =   41
               TabStop         =   0   'False
               Top             =   2010
               Width           =   3165
               _ExtentX        =   5371
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               DecimalPlace    =   2
               Locked          =   -1  'True
               Label           =   "Gross W/ VAT"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1450
               TextBoxWidth    =   1655
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtCurrencyRate 
               Height          =   285
               Left            =   -67320
               TabIndex        =   13
               Top             =   810
               Width           =   2850
               _ExtentX        =   4815
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BorderColor     =   16243138
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               DecimalPlace    =   2
               Label           =   "Currency Rate"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1425
               TextBoxWidth    =   1365
               LinkForeColor   =   0
            End
            Begin VB.CommandButton cmdPickSM 
               Height          =   285
               Left            =   2715
               Picture         =   "frmBasicARSalesOrder.frx":0D26
               Style           =   1  'Graphical
               TabIndex        =   8
               Top             =   1410
               Width           =   285
            End
            Begin VB.CommandButton cmdPickCode 
               Height          =   285
               Left            =   2715
               Picture         =   "frmBasicARSalesOrder.frx":0E70
               Style           =   1  'Graphical
               TabIndex        =   4
               Top             =   510
               Width           =   285
            End
            Begin ITGControls.ITGTextBox txtTerms 
               Height          =   285
               Left            =   9705
               TabIndex        =   32
               Tag             =   "cboTerms"
               Top             =   810
               Visible         =   0   'False
               Width           =   1155
               _ExtentX        =   1931
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Actual Terms"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   1095
            End
            Begin ITGControls.ITGTextBox txtPaymentType 
               Height          =   285
               Left            =   9795
               TabIndex        =   31
               Tag             =   "cboPayment"
               Top             =   1110
               Visible         =   0   'False
               Width           =   1155
               _ExtentX        =   1931
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Payment Type"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   1095
            End
            Begin ITGControls.ITGTextBox txtIntTerms 
               Height          =   285
               Left            =   9795
               TabIndex        =   30
               Tag             =   "cboIntTerms"
               Top             =   525
               Visible         =   0   'False
               Width           =   1155
               _ExtentX        =   1931
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Internal Terms"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   1095
            End
            Begin ITGControls.ITGTextBox txtCode 
               Height          =   285
               Left            =   165
               TabIndex        =   3
               Top             =   510
               Width           =   2520
               _ExtentX        =   4233
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14745599
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Mandatory       =   -1  'True
               Label           =   "Customer"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   1135
               Required        =   -1  'True
               LinkForeColor   =   16711680
            End
            Begin ITGControls.ITGTextBox txtAddress 
               Height          =   285
               Left            =   165
               TabIndex        =   5
               Top             =   810
               Width           =   6870
               _ExtentX        =   11906
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Address"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   5485
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtContact 
               Height          =   285
               Left            =   165
               TabIndex        =   6
               Top             =   1110
               Width           =   6870
               _ExtentX        =   11906
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Contact"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   5485
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtName 
               Height          =   285
               Left            =   3000
               TabIndex        =   29
               TabStop         =   0   'False
               Top             =   510
               Width           =   4040
               _ExtentX        =   7011
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   3975
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSMName 
               Height          =   285
               Left            =   3000
               TabIndex        =   28
               TabStop         =   0   'False
               Top             =   1410
               Width           =   4035
               _ExtentX        =   7011
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   3975
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtSMCode 
               Height          =   285
               Left            =   165
               TabIndex        =   7
               Top             =   1410
               Width           =   2520
               _ExtentX        =   4233
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14745599
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Mandatory       =   -1  'True
               Label           =   "Salesman"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   1135
               Required        =   -1  'True
               LinkForeColor   =   16711680
            End
            Begin VB.CommandButton cmdPickMS 
               Height          =   300
               Left            =   -72330
               Picture         =   "frmBasicARSalesOrder.frx":0FBA
               Style           =   1  'Graphical
               TabIndex        =   10
               Top             =   510
               Width           =   315
            End
            Begin VB.ComboBox cboCurrency 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               Left            =   -65865
               Style           =   2  'Dropdown List
               TabIndex        =   12
               Top             =   510
               Width           =   1390
            End
            Begin ITGControls.ITGTextBox txtMSCode 
               Height          =   285
               Left            =   -74835
               TabIndex        =   9
               Top             =   510
               Width           =   2475
               _ExtentX        =   4154
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14745599
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Market Segment"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   1090
               Required        =   -1  'True
            End
            Begin ITGControls.ITGTextBox txtMSDesc 
               Height          =   285
               Left            =   -72015
               TabIndex        =   27
               TabStop         =   0   'False
               Top             =   510
               Width           =   4095
               _ExtentX        =   7117
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   4035
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGDateBox dtgExpiration 
               Height          =   285
               Left            =   -65865
               TabIndex        =   14
               Tag             =   "Order Date"
               Top             =   1110
               Width           =   1395
               _ExtentX        =   2461
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   ""
               SendKeysTab     =   -1  'True
               Mandatory       =   -1  'True
            End
            Begin ITGControls.ITGTextBox txtCurrency 
               Height          =   285
               Left            =   -65835
               TabIndex        =   26
               Top             =   510
               Visible         =   0   'False
               Width           =   1050
               _ExtentX        =   1746
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   990
            End
            Begin ITGControls.ITGTextBox txtCPONo 
               Height          =   285
               Left            =   -67320
               TabIndex        =   15
               Top             =   1410
               Width           =   2850
               _ExtentX        =   4815
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Customer PO No."
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1425
               TextBoxWidth    =   1365
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtRemarks 
               Height          =   285
               Left            =   -74835
               TabIndex        =   11
               Top             =   810
               Width           =   6915
               _ExtentX        =   11986
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Remarks"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   5530
               LinkForeColor   =   0
            End
            Begin VB.CommandButton cmdPickDelCode 
               Height          =   300
               Left            =   -72300
               Picture         =   "frmBasicARSalesOrder.frx":1104
               Style           =   1  'Graphical
               TabIndex        =   17
               Top             =   555
               Width           =   315
            End
            Begin ITGControls.ITGTextBox txtDelName 
               Height          =   285
               Left            =   -71985
               TabIndex        =   25
               TabStop         =   0   'False
               Top             =   555
               Width           =   4050
               _ExtentX        =   7038
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "ITGtext"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   3990
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtDelCode 
               Height          =   285
               Left            =   -74835
               TabIndex        =   16
               Top             =   555
               Width           =   2500
               _ExtentX        =   4207
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14745599
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Customer"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   1120
               LinkForeColor   =   16711680
            End
            Begin ITGControls.ITGTextBox txtDelAddress 
               Height          =   285
               Left            =   -74835
               TabIndex        =   18
               Top             =   855
               Width           =   6885
               _ExtentX        =   11933
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Address"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   5500
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtDelContact 
               Height          =   285
               Left            =   -74835
               TabIndex        =   19
               Top             =   1155
               Width           =   6885
               _ExtentX        =   11933
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Label           =   "Contact"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1325
               TextBoxWidth    =   5500
               LinkForeColor   =   0
            End
            Begin ITGControls.ITGTextBox txtFax 
               Height          =   285
               Left            =   -67590
               TabIndex        =   21
               Tag             =   "C"
               Top             =   855
               Width           =   3090
               _ExtentX        =   5239
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               MaxLength       =   20
               Label           =   "Fax No"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   900
               TextBoxWidth    =   2130
            End
            Begin ITGControls.ITGTextBox txtEMail1 
               Height          =   285
               Left            =   -67590
               TabIndex        =   22
               Tag             =   "C"
               Top             =   1155
               Width           =   3090
               _ExtentX        =   5239
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               MaxLength       =   50
               Label           =   "e-Mail"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   900
               TextBoxWidth    =   2130
            End
            Begin ITGControls.ITGTextBox txtPhone1 
               Height          =   285
               Left            =   -67590
               TabIndex        =   20
               Tag             =   "C"
               Top             =   555
               Width           =   3090
               _ExtentX        =   5239
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               MaxLength       =   20
               Label           =   "Tel No"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   900
               TextBoxWidth    =   2130
            End
            Begin VB.Label Label7 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Delivery Date"
               Height          =   255
               Left            =   7335
               TabIndex        =   58
               Top             =   2340
               Width           =   1230
            End
            Begin VB.Label Label6 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Expiration"
               Height          =   240
               Left            =   -67290
               TabIndex        =   56
               Top             =   1155
               Width           =   1305
            End
            Begin VB.Label Label4 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Internal Terms"
               Height          =   285
               Index           =   1
               Left            =   7320
               TabIndex        =   52
               Top             =   510
               Width           =   1305
            End
            Begin VB.Label Label2 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Customer Terms"
               Height          =   285
               Left            =   7320
               TabIndex        =   51
               Top             =   810
               Width           =   1305
            End
            Begin VB.Label Label3 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Payment Type"
               Height          =   285
               Left            =   7320
               TabIndex        =   50
               Top             =   1110
               Width           =   1305
            End
            Begin VB.Label Label5 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Tax Type"
               Height          =   285
               Left            =   165
               TabIndex        =   49
               Top             =   1725
               Width           =   1305
            End
            Begin VB.Label lblStatus 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Status"
               BeginProperty Font 
                  Name            =   "Tahoma"
                  Size            =   24
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ForeColor       =   &H00C0C0C0&
               Height          =   495
               Left            =   105
               TabIndex        =   42
               Top             =   2040
               Width           =   3060
            End
            Begin VB.Label Label1 
               BackColor       =   &H00F7D9C2&
               Caption         =   "Currency"
               Height          =   240
               Left            =   -67275
               TabIndex        =   33
               Top             =   510
               Width           =   1305
            End
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   8250
            TabIndex        =   34
            Tag             =   "cboType"
            Top             =   555
            Width           =   2340
            _ExtentX        =   3916
            _ExtentY        =   503
            BackColor       =   16243138
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Order Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1080
            Required        =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   6135
            TabIndex        =   1
            Tag             =   "Order Date"
            Top             =   555
            Width           =   1500
            _ExtentX        =   2646
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtSONo 
            Height          =   285
            Left            =   135
            TabIndex        =   0
            Top             =   555
            Width           =   3000
            _ExtentX        =   5080
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Order No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1325
            TextBoxWidth    =   1615
            Required        =   -1  'True
         End
         Begin VB.Label ITGLabel4 
            BackColor       =   &H00F7D9C2&
            Caption         =   "Order Date"
            Height          =   255
            Left            =   4920
            TabIndex        =   36
            Top             =   600
            Width           =   1230
         End
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   35
      Top             =   7635
      Width           =   11535
      _ExtentX        =   20346
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   7119
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   2940
      Left            =   30
      Top             =   4125
      Width           =   11445
      _ExtentX        =   20188
      _ExtentY        =   5186
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Order Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin VB.TextBox txtLongDesc 
         Appearance      =   0  'Flat
         DataField       =   "cLongDesc"
         Height          =   1215
         Left            =   1740
         MaxLength       =   1000
         MultiLine       =   -1  'True
         TabIndex        =   39
         Top             =   990
         Visible         =   0   'False
         Width           =   4065
      End
      Begin VB.ComboBox cboSO 
         Height          =   315
         ItemData        =   "frmBasicARSalesOrder.frx":124E
         Left            =   315
         List            =   "frmBasicARSalesOrder.frx":1250
         Style           =   2  'Dropdown List
         TabIndex        =   38
         Top             =   1320
         Visible         =   0   'False
         Width           =   1395
      End
      Begin MSDataGridLib.DataGrid dtgSO 
         Height          =   2460
         Left            =   0
         TabIndex        =   40
         Top             =   480
         Width           =   11445
         _ExtentX        =   20188
         _ExtentY        =   4339
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         Appearance      =   0
         BackColor       =   16777215
         HeadLines       =   1
         RowHeight       =   15
         TabAcrossSplits =   -1  'True
         TabAction       =   2
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   17
         BeginProperty Column00 
            DataField       =   "cSONo"
            Caption         =   "Sales Order ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cItemNo"
            Caption         =   "Product ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cDesc"
            Caption         =   "Product Description"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cUnit"
            Caption         =   "Unit"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "nQty"
            Caption         =   "Quantity"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cPricing"
            Caption         =   "Pricing"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "#,##0.00000000"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "nPrice"
            Caption         =   "Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.0000"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "cDiscount"
            Caption         =   "Discount"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column08 
            DataField       =   "nNetPrice"
            Caption         =   "Net Price"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.0000"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column09 
            DataField       =   "nAmount"
            Caption         =   "Amount"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column10 
            DataField       =   "cStatus"
            Caption         =   "Product Status"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "M/d/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column11 
            DataField       =   "dDelDate"
            Caption         =   "Delivery Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column12 
            DataField       =   "nSMCom"
            Caption         =   "Com %"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column13 
            DataField       =   "cRefNo"
            Caption         =   "Reference No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column14 
            DataField       =   "cWH"
            Caption         =   "Warehouse"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column15 
            DataField       =   "cVatType"
            Caption         =   "VAT-Type"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column16 
            DataField       =   "nFactor"
            Caption         =   "Factor"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   13321
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Button          =   -1  'True
               Locked          =   -1  'True
               Object.Visible         =   0   'False
               ColumnWidth     =   1124.787
            EndProperty
            BeginProperty Column01 
               Button          =   -1  'True
               ColumnWidth     =   1275.024
            EndProperty
            BeginProperty Column02 
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   2190.047
            EndProperty
            BeginProperty Column03 
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   794.835
            EndProperty
            BeginProperty Column04 
               Alignment       =   1
               ColumnWidth     =   989.858
            EndProperty
            BeginProperty Column05 
               Alignment       =   1
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column06 
               Alignment       =   1
               Button          =   -1  'True
               ColumnWidth     =   989.858
            EndProperty
            BeginProperty Column07 
               Object.Visible         =   0   'False
               ColumnWidth     =   975.118
            EndProperty
            BeginProperty Column08 
               Alignment       =   1
               Locked          =   -1  'True
               Object.Visible         =   0   'False
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column09 
               Alignment       =   1
               Locked          =   -1  'True
               Object.Visible         =   -1  'True
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column10 
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1305.071
            EndProperty
            BeginProperty Column11 
               Object.Visible         =   0   'False
               ColumnWidth     =   1244.976
            EndProperty
            BeginProperty Column12 
               Alignment       =   1
               Object.Visible         =   0   'False
               ColumnWidth     =   615.118
            EndProperty
            BeginProperty Column13 
               Locked          =   -1  'True
               Object.Visible         =   0   'False
               ColumnWidth     =   1049.953
            EndProperty
            BeginProperty Column14 
               Button          =   -1  'True
               ColumnWidth     =   1065.26
            EndProperty
            BeginProperty Column15 
               Button          =   -1  'True
               Object.Visible         =   0   'False
            EndProperty
            BeginProperty Column16 
               Object.Visible         =   0   'False
               ColumnWidth     =   14.74
            EndProperty
         EndProperty
      End
   End
End
Attribute VB_Name = "frmBasicARSalesOrder"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'Object variables
Private oPrint As New clsPrinting

Private AutoNum As New clsAutoNumber '---Added
Public MenuName As String '---Added

'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

Private rsAuto As ADODB.Recordset

'ADO Connection variables
Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection

'Form mode enumeration
Enum eBasicSOMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eBasicSOMode

'Other declarations
Private lLessAmount As Boolean
Private lLessPercent As Boolean
Private lNetOK As Boolean
Private net As Double

Private lSysTransDate As Boolean 'add by denz:2/17/2011 for transdate

Public dtgName As String
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable
Private lSystemGenerated As Boolean

Public lSystemGeneratedSO As Boolean
Private strNo As String
Private sAuto As String
Private sCustCode As String
Private sBarcodeID As String
'Auto Approval Variables
Public lAutoCL As Boolean
Public lAutoPrice As Boolean
Public lAutoStock As Boolean

Dim aQty(0 To 999) As Double

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub cboCurrency_Click()
    txtCurrency = Trim(cboCurrency)
    If Mode <> AddNewEdit Then Exit Sub
    txtCurrencyRate = GetValueFrTable("nRate", "CURRENCY", "cCurrency = '" & Trim(txtCurrency) & "'")
End Sub

Private Sub cboCurrency_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboIntTerms_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboPaymentType_Click()
    txtPaymentType = Trim(cboPaymentType)
End Sub

Private Sub cboPaymentType_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SSTab2.ActiveTab = 1
    SendKeysTab KeyAscii
End Sub

Private Sub cboTaxType_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SSTab2.ActiveTab = 1
    SendKeysTab KeyAscii
End Sub

Private Sub cboTaxType_Click()
    txtTaxType = Trim(cboTaxType)
End Sub

Private Sub cboSO_Click()
On Error GoTo ErrorHandler
    If dtgSO.Col = 5 Then
        If Trim(cboSO) <> "" Then
            rsDetail!cPricing = cboSO
            ComputeNet
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
        End If
    ElseIf dtgSO.Col = 10 Then
        rsDetail!cStatus = cboSO
    ElseIf dtgSO.Col = 14 Then
        rsDetail!cWH = cboSO
    ElseIf dtgSO.Col = 3 Then
        cboSO = rsDetail!cUnit
        rsDetail!nFactor = GetValueFrTable("nFactor", "ITEM_UNIT", "cItemNo= '" & Trim(rsDetail!cItemNo) & "' and cUnit = '" & rsDetail!cUnit & "'")
        GetRWMPrice
        ComputeNet
        ComputeTotalDisc
        ComputeAmount
        ComputeTotal
    End If
    
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub cboSO_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo ErrorHandler
    If KeyCode = 13 Then
        If dtgSO.Col = 5 Then
            rsDetail!cPricing = cboSO
            cboSO.Visible = False
            dtgSO.Col = 6
            dtgSO.SetFocus
        ElseIf dtgSO.Col = 10 Then
            
            If Trim(rsDetail!cStatus) = "Labor" Then Exit Sub
            Call LoadComboValues(cboSO, "cParamName", "PARAMETER_SYSTEM", "WHERE cType = 'PRODSTATUS'", "nOrder")
            Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(10))
            ComboLoadValue cboSO, Trim(rsDetail!cStatus)
            
            cboSO.Visible = False
            dtgSO.Col = 11
            dtgSO.SetFocus
        ElseIf dtgSO.Col = 3 Then
            rsDetail!cUnit = cboSO
            cboSO.Visible = False
            dtgSO.Col = 4
            dtgSO.SetFocus
        ElseIf dtgSO.Col = 15 Then
            Call LoadComboValues(cboSO, "cValue", "PARAMETER_USER", "WHERE cType = 'VAT-TYPE'", "nOrder")
            Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(15))
            ComboLoadValue cboSO, Trim(rsDetail!cVatType)
            
            cboSO.Visible = False
            dtgSO.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboSO.Visible = False
    End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub cboSO_LostFocus()
    
If Me.ActiveControl.Name <> "cboSO" Then
    cboSO.Visible = False
End If
End Sub

Private Sub cboTerms_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboType_Click()
If Mode <> AddNewEdit Then Exit Sub
    txtType = Trim(cboType)
    Do Until rsDetail.EOF
        GetChild
        rsDetail.Delete adAffectCurrent
        rsDetail.MoveNext
    Loop
End Sub

Private Sub cboIntTerms_Click()
    txtIntTerms = Trim(cboIntTerms)
End Sub

Private Sub cboTerms_Click()
    txtTerms = Trim(cboTerms)
End Sub

Private Sub cboType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub chkVATType_Click()
    If Mode <> AddNewEdit Then Exit Sub
    ComputeTotalDisc
    ComputeTotal
End Sub

'Call pick list module
Private Sub cmdPickCode_Click()
Dim rsUser As New ADODB.Recordset
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtCode)
    With frmITGPicker
        .zType = QCustomer
        'added condition
        frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
        .Show vbModal
        txtCode = .zCode
        txtName = .zName
        txtContact = GetValueFrTable("cContact", "Client_Customer", "cCode = '" & Trim(.zCode) & "'")
    End With
End Sub

Private Sub cmdPickDelCode_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtDelCode)
    With frmITGPicker
        .zType = QCustomer
        'added condition
        frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
        .Show vbModal
        txtDelCode = .zCode
        txtDelName = .zName
    End With
End Sub

Private Sub cmdPickMS_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtMSCode)
    frmITGPicker.zType = QMarketSegment
    'added condition
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtMSCode = frmITGPicker.zCode
    txtMSDesc = frmITGPicker.zName
    If Trim(txtMSDesc) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickSM_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtSMCode)
    frmITGPicker.zType = QSalesman
    'added condition
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtSMCode = frmITGPicker.zCode
    txtSMName = frmITGPicker.zName
    If Trim(txtSMName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

'After column update
Private Sub dtgSO_AfterColUpdate(ByVal ColIndex As Integer)
On Error GoTo ErrorHandler
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") <> "" Then
                GetInitialItemValues
                dtgSO_ButtonClick 2
                dtgSO.Col = 3
                rsDetail!cUnit = rsDetail!cUnit
            Else
                If lPickListActive Then Exit Sub
                sFilterString = Trim(rsDetail!cItemNo)
                frmITGPicker.zType = QProduct
                'added condition
                frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
                
                frmITGPicker.Show vbModal
                rsDetail!cItemNo = Trim(frmITGPicker.zCode) & ""
                
                If (Trim(frmITGPicker.zName) & "") <> "" Then
                    dtgSO.Col = 3
                    GetInitialItemValues
                    GetRWMPrice
                    End If
            End If
        Case 4
forLabor:
            ComputeNet
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
        Case 5
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
        Case 6
            ComputeNet
            If Not lNetOK Then Exit Sub
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
        Case 7
            If Right(Trim(rsDetail!cDiscount), 1) = "-" Then
                rsDetail!cDiscount = Mid(Trim(rsDetail!cDiscount), 1, Len(Trim(rsDetail!cDiscount)) - 1)
                lLessAmount = False
            End If
            
            ComputeNet
            If Not lNetOK Then Exit Sub
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
        Case 15
            ComputeNet
            ComputeTotalDisc
            ComputeAmount
            ComputeTotal
    End Select

ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgSO_ButtonClick(ByVal ColIndex As Integer)
On Error GoTo ErrorHandler
If ColIndex = 2 Then
    If Mode <> Find Then
        Call MoveText(txtLongDesc, dtgSO, dtgSO.Columns(2))
        txtLongDesc = rsDetail!cLongDesc & ""
    End If
End If
If Mode = AddNewEdit Then 'Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") = "" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(rsDetail!cItemNo)
                frmITGPicker.zType = QProduct
                'added condition
                frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
                
                frmITGPicker.Show vbModal
                rsDetail!cItemNo = Trim(frmITGPicker.zCode) & ""
                rsDetail!cDesc = GetValueFrTable("cDesc", "ITEM", "cItemNo = '" & rsDetail!cItemNo & "'", True)
                If (Trim(frmITGPicker.zName) & "") <> "" Then
                    dtgSO.Col = 3
                    GetInitialItemValues
                    GetRWMPrice
                End If
            End If
        Case 3
            If rsDetail!cItemNo <> "" Then
                If GetValueFrTable("cUnit", "ITEM_UNIT", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") <> "" Then
                    Call LoadComboValues(cboSO, "cUnit", "ITEM_UNIT", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                Else: Call LoadComboValues(cboSO, "cParamName", "PARAMETER_USER", "WHERE cType = 'ITEMUNIT'")
                End If
                Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(3))
                ComboLoadValue cboSO, Trim(rsDetail!cUnit)
            End If
            dtgSO.Col = 3
        Case 5
            Call LoadComboValues(cboSO, "cValue", "PARAMETER_SYSTEM", "WHERE cType = 'PRICING'", "nOrder")
            Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(5))
            ComboLoadValue cboSO, Trim(rsDetail!cPricing)
        Case 10
            If Trim(rsDetail!cStatus) = "Labor" Then Exit Sub
            Call LoadComboValues(cboSO, "cParamName", "PARAMETER_SYSTEM", "WHERE cType = 'PRODSTATUS'", "nOrder")
            Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(10))
            ComboLoadValue cboSO, Trim(rsDetail!cStatus)
        Case 14
            Call LoadComboValues(cboSO, "cWH", "WHSE", "WHERE cCompanyID = '" & COID & "'")
            Call MoveCombo(cboSO, dtgSO, dtgSO.Columns(14))
            ComboLoadValue cboSO, Trim(rsDetail!cWH)
        End Select
    Else
        Select Case ColIndex
            Case 1
                If Mode <> Find Then
                    If Trim(rsDetail!cItemNo) <> "" Then
                    End If
            End If
        End Select
    End If

ErrorHandler:
    If err.Number <> 0 And err.Number <> -2147217908 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgSO_Click()
    If Mode = AddNewEdit Then dtgName = dtgSO.Name
End Sub

Private Sub dtgSO_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgSO_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub


Private Sub dtgSO_KeyPress(KeyAscii As Integer)
On Error GoTo ErrorHandler
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub
        
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgSO.Col
            Case 1
                If cboSO.Visible = False Then
                    dtgSO_ButtonClick (1)
                Else
                    SendKeys "{Tab}"
                End If
            Case 3
                If cboSO.Visible = False Then
                    dtgSO_ButtonClick (3)
                Else
                    SendKeys "{Tab}"
                End If
            Case 4   ' code for compute the nAmount
                ComputeNet
                ComputeTotalDisc
                ComputeAmount
                ComputeTotal
                SendKeys "{Tab}"
            Case 5
                If cboSO.Visible = False Then
                    dtgSO_ButtonClick (5)
                    If Trim(rsDetail!cPricing) <> "" Then cboSO = Trim(rsDetail!cPricing)
                Else: SendKeys "{Tab}"
                End If
            Case 7
                rsDetail!cDiscount = rsDetail!cDiscount
                dtgSO_AfterColUpdate (7)
                dtgSO.Col = 10

                If Not lNetOK Then
                    dtgSO.Col = 7
                    rsDetail!cDiscount = rsDetail!cDiscount
                    Exit Sub
                End If
            Case 10
                If cboSO.Visible = False Then
                    dtgSO_ButtonClick (10)
                    If Trim(rsDetail!cStatus) <> "" Then cboSO = Trim(rsDetail!cStatus)
                Else: SendKeys "{Tab}"
                End If
            Case 11
                TBNewLine
                dtgSO.LeftCol = 1
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        Select Case dtgSO.Col
            Case 7
                KeyAscii = ValidKeys(KeyAscii, "-/1234567890.", True)
            Case Else
                KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
        End Select
    End If
    
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub dtgSO_KeyUp(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub
    Select Case dtgSO.Col
        Case 7
            If Trim(rsDetail!cDiscount) = "/" Then
                rsDetail!cDiscount = ""
                lLessPercent = False
            End If
    End Select
End Sub

'Right click menu popup
Private Sub dtgSO_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgSO.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgSO_Scroll(Cancel As Integer)
    cboSO.Visible = False
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()
    Dim a As String
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BAR01'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
    
    'Load OrderType Values
    a = GetValueFrTable("module_id", "erp_sec_modules", " link='" & Me.Name & "'", True)
    Call LoadComboValues(cboType, "RefType", "ComboValueSetUp", "Where RefModule = '" & a & "' AND Visible = 1" & _
    " and cCompanyID = '" & Trim(COID) & "'")
    
    'Load combobox values
    Call LoadComboValues(cboTerms, "cParamName", "PARAMETER_USER", "WHERE cType = 'TERMS' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    Call LoadComboValues(cboIntTerms, "cParamName", "PARAMETER_USER", "WHERE cType = 'TERMS' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    Call LoadComboValues(cboPaymentType, "cValue", "PARAMETER_SYSTEM", "WHERE cType = 'SOPAYTYPE'")
    Call LoadComboValues(cboCurrency, "cCurrency", "CURRENCY", "WHERE cCompanyID = '" & Trim(COID) & "'")
    Call LoadComboValues(cboTaxType, "cParamName", "PARAMETER_USER", "WHERE cType = 'TAXTYPE' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    txtType.Enabled = False
    txtType.Visible = False
    cboType.Enabled = False
    cboType.Visible = False
    Mode = Find
    txtSONo.Locked = False
    txtVatRATE.Locked = True
    
    
    lNetOK = True 'Boolean variable for discount computation
        
    'Auto Approval Variables
    lAutoCL = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'AUTOAPPROVE_CL' ")
    lAutoPrice = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'AUTOAPPROVE_PRICE' ")
    lAutoStock = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'AUTOAPPROVE_STOCK' ")
    
End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    Set oPrint = Nothing
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsAuto = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing
    
    Set frmBasicARSalesOrder = Nothing
    lCloseWindow = True
End Sub

'Add new record to the recordset
Public Sub TBNew()
'On Error GoTo ErrorHandler
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtSONo.SetFocus
    txtSONo.BackColor = &HE0FFFF
    Mode = AddNewEdit
    
    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "SO_T", connDetail, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "SO", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else: vBM = rsHeader.Bookmark
    End If
    
    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    rsHeader!cType = "Regular"
    rsHeader!cCurrency = "PHP"

    rsHeader!cPreparedBy = SecUserID
    rsHeader!cPCCode = sDivision
    
    rsHeader!cPayType = "Credit"
    txtVatRATE.Locked = True
    chkVATType.Value = IIf(GetValueFrTable("lBit", "System_Option", "cCode = 'DEF_VAT_RATE'"), Checked, Unchecked)
    rsHeader!lVatinclusive = IIf(chkVATType.Value = Checked, 1, 0)
    rsHeader!nVatRate = GetValueFrTable("cValue", "System_Option", "cCode = 'DEF_VAT_RATE'")
                
'    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab2.ActiveTab = 0
    txtNet.Locked = True
    txtVatAmount.Locked = True
    SSTab1.ActiveTab = 0
    txtSONo.Locked = False
    txtSONo.SetFocus
    txtSONo.Locked = True

    MenuName = "AUTO_NUMBER_SO"
    lSystemGenerated = GetValueFrTable("lAutoNo", "system_autonumber", "cCode = '" & MenuName & "' ")
    If lSystemGenerated Then rsHeader!cSONO = AutoNum.Generate_CtrlNo2("AUTO_NUMBER_SO", Format(Now, "mm/dd/yyyy"))
    
    strNo = rsHeader!cSONO

'ErrorHandler:
'    If err.Number <> 0 And err.Number <> 3021 Then
'        MsgBox err.Description, vbInformation, msgTtl
'    End If
End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True, , True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    SetDataSource
    SetDataField

ErrorHandler:
    cboSO.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If
End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If
End Sub

'Save all changes
Public Sub TBSave()
Dim OKUpdate As Boolean
Dim lNew As Boolean
On Error GoTo ErrHandler

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then
        lBoolean = True
        rsHeader!dPrepared = Now
    End If
    
    If Not MandatoryOK Then Exit Sub
    
    'Discount validation
    ComputeNet
    If Not lNetOK Then
        dtgSO.SetFocus
        Exit Sub
    End If
    ComputeTotalDisc
    ComputeAmount
    ComputeTotal
   
    If rsHeader.Status = adRecNew Then
        If lSystemGenerated Then
            If AutoNum.Check_CtrlNo2(rsHeader, "SO", "cSONo", rsHeader!cSONO, MenuName, rsHeader!dDate) <> rsHeader!cSONO Then
                GetChild
                rsHeader!cSONO = strNo
                If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
                Do Until rsDetail.EOF
                    rsDetail!cSONO = strNo
                    rsDetail.MoveNext
                Loop
                GetChild
            End If
        End If
    End If
      
    rsHeader!lCApproved = lAutoCL
    rsHeader!lPApproved = lAutoPrice
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connDetail.CommitTrans
    connHeader.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, False, , , , lACCancel, , , True, True, lACPrint, True, , True
    Mode = Normal
    
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    sbRS.Panels(2) = ""
    SSTab2.ActiveTab = 0
    
    If lBoolean = False Then ' Edit
    cn.Execute ("UPDATE SO SET dUpdated = GETDATE () WHERE cSONo = '" & Trim(txtSONo) & "' AND cCompanyID = '" & COID & "'")
    Else ' Insert
    cn.Execute ("UPDATE SO SET dUpdated = GETDATE () WHERE cSONo = '" & Trim(txtSONo) & "' AND cCompanyID = '" & COID & "'")
    End If
    
    'Audit trail
    UpdateLogFile "Sales Order", Trim(txtSONo), IIf(lBoolean, "Inserted", "Updated")
    
    'System generated so no
    If lBoolean = True Then
        If lSystemGenerated = True Then
            AutoNum.Update_CtrlNo2 strNo, MenuName, Format(Now, "mm/dd/yyyy")
        End If
    End If
    '----------------------

ErrHandler:
    cboSO.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connDetail.RollbackTrans
        connHeader.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else: RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connDetail.RollbackTrans
        connHeader.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

'Sets the form & recorset to add/edit mode
Public Sub TBEdit()
On Error GoTo ErrorHandler
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, msgTtl
        Exit Sub
    ElseIf rsHeader!lserved = True Then
        MsgBox "Transaction was already served. Deletion is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    If Not AllowEdit Then Exit Sub
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtNet.Locked = True
    txtVatAmount.Locked = True
    SSTab1.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
    
    MenuName = "AUTO_NUMBER_SO"
    lSysTransDate = GetValueFrTable("lTransDate", "system_autonumber", "cCode = '" & MenuName & "' ") 'add by denz:2/17/2011
    If lSysTransDate Then
        dtbDate.Enabled = True
    Else: dtbDate.Enabled = False
    End If
    
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

'Delete record
Public Sub TBDelete()
On Error GoTo ErrorHandler
    
    sID = Trim(txtSONo)
    If rsHeader.RecordCount = 0 Then Exit Sub
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Deletion is not allowed.", vbExclamation, msgTtl
        Exit Sub
    ElseIf rsHeader!lserved = True Then
        MsgBox "Transaction was already served. Deletion is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    
    If Not AllowDelete("delete") Then Exit Sub
        
    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If
    
    'Audit trail
    UpdateLogFile "Sales Order", Trim(txtSONo), "Deleted"

    rsHeader.Delete adAffectCurrent
    
    rsDetail.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec

    Mode = Normal
    
    If rsHeader.RecordCount = 0 Then RSZero

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE SO_T WHERE cSONo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE SO WHERE cSONo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If
End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtSONo.Locked = True
    frmITGSearch.Show 'vbModal
End Sub

'Search using the recordset primary key
Public Sub TBFindPrimary()
On Error GoTo ErrorHandler
Dim sTemp As String
    If Mode = Find Then
        FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        
        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset
                
        sTemp = Trim$(GetSearchString)
        If sTemp = "ERROR" Then
            MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
            txtSONo.Locked = False
            txtSONo.SetFocus
            Exit Sub
        End If
        
        OpenRecordsetWithCN rsHeader, "*", "SO", connHeader, IIf(sTemp = "", "where cType <> 'EXPORT' ", " WHERE cType <> 'EXPORT' and " & sTemp)
        OpenRecordsetWithCN rsDetail, "*", "SO_T", connDetail, IIf(sTemp = "", "", " WHERE cSONo IN (SELECT cSONo FROM SO WHERE " & sTemp & ")")
           
        Set FrmName = Me
        FormLocking True
                
        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            cboType.ListIndex = -1
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
        SetDataSource
        SetDataField
        txtSONo.BackColor = &HE0FFFF
        Mode = Normal
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, False, , , , lACCancel, , , True, True, lACPrint, True, , True
        FormWaitHide
    Else
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
    End If

ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgSO.Name
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
End Sub

'Move previuos
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader
End Sub

'Add new line to the detail recordset
Public Sub TBNewLine()
On Error GoTo ErrorHandler
    If rsHeader!cSONO = "" Then Exit Sub
    
    If dtgName = "dtgSO" Then
        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cSONO = Trim(rsHeader!cSONO)
        rsDetail!lDRReady = lAutoStock
        dtgSO.Col = 0
        GetChild
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast
        dtgSO.Col = 0
        rsDetail!cItemNo = ""
        dtgSO.SetFocus
    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

'Delete line in the detail recordset
Public Sub TBDeleteLine()
On Error GoTo ErrorHandler
    
    If dtgName = "dtgSO" Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgSO.Bookmark
        GetChild
        dtgSO.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
        ComputeTotal
        cboSO.Visible = False 'gino code
    End If
    GetChild
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo All
Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    If dtgName = "dtgSO" Then
        rsDetail.CancelBatch adAffectAll
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Post current record
Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Cancel current record
Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    If Not AllowDelete("cancel") Then Exit Sub
    
    cString = ""
    frmRemarks.fraRemarks.Caption = "Sales order cancellation remarks"
    frmRemarks.Show vbModal
    rsHeader!cCRemarks = cString
    
    cn.Execute ("UPDATE SO SET dUpdated = GETDATE () WHERE cSONo = '" & Trim(txtSONo) & "' AND cCompanyID = '" & COID & "'")

    'Audit trail
    UpdateLogFile "Sales Order", Trim(txtSONo), "Cancelled"

    cn.Execute ("UPDATE SO SET lCancelled = 1 WHERE cSONo = '" & Trim(txtSONo) & "' AND cCompanyID = '" & COID & "'")
    
    sbRS.Panels(5) = "CANCELLED"
    lblStatus.Caption = "Cancelled"
    lblStatus.ForeColor = &H8080FF
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Print
Public Sub TBPrintRecord()
    RepName = "BASIC_Delivery_Receipt_Trans"
    cModule = "Basic_Sales_Order"
    oPrint.PrintReceipt Trim(txtSONo)
End Sub

Public Sub TBReference()
    RepName = "SO"
    frmReferenceTrans.mReferType = JSO
    frmReferenceTrans.mRefPK = txtSONo
    frmReferenceTrans.Show 1
End Sub

'Sets the data source of the controls
Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgSO.DataSource = rsDetail
    Set txtLongDesc.DataSource = rsDetail
    
End Sub
    
'Sets the data field for every bounded controls
Sub SetDataField()
On Error GoTo ErrorHandler
    With rsHeader
        txtSONo.DataField = !cSONO
        dtbDate.DataField = !dDate
        txtType.DataField = !cType
        txtCode.DataField = !cCode
        txtAddress.DataField = !cAddress
        txtContact.DataField = !cContact
        txtDelCode.DataField = !cDelCode
        txtDelAddress.DataField = !cDelAddress
        txtDelContact.DataField = !cDelContact
        txtSMCode.DataField = !cSMan
        txtMSCode.DataField = !cMSCode
        txtRemarks.DataField = !cRemarks
        txtNet.DataField = !nNet
        txtIntTerms.DataField = !cIntTerm
        txtTerms.DataField = !cTerm
        txtPaymentType.DataField = !cPayType
        txtCurrency.DataField = !cCurrency
        txtCurrencyRate.DataField = !nCurrencyRate
        txtCPONo.DataField = !cCPONo
        dtgExpiration.DataField = !dExpiration
        txtTaxType.DataField = !cTaxType
        txtVatAmount.DataField = !nVatAmount
        chkVATType.DataField = !lVatinclusive
        txtVatRATE.DataField = !nVatRate
        txtTotalAmount.DataField = !nTotalAmount
        dtbDeliveryDate.DataField = !dDeliveryDate
    End With
    Exit Sub
ErrorHandler:
    If err.Number = 440 Then
        'Resume Next
    ElseIf err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler
    
    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        'Status bar setup
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount
        
        If rsHeader.Status <> adRecNew Then
            txtSONo.Locked = True
        Else: txtSONo.Locked = False
        End If
        
        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else: sbRS.Panels(2) = ""
        End If
        
        GetChild
    
        If rsHeader!lCancelled = True Then
            sbRS.Panels(4) = IIf(IsNull(rsHeader!cCRemarks), "", Trim(rsHeader!cCRemarks))
            sbRS.Panels(5) = "CANCELLED"
            lblStatus.Caption = "Cancelled"
            lblStatus.ForeColor = &H8080FF
        ElseIf rsHeader!lCApproved = True Then
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = ""
            lblStatus.Caption = "Approved"
            lblStatus.ForeColor = &HC0C0C0
        ElseIf rsHeader!lserved = True Then
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = "SERVED"
            lblStatus.Caption = "Served"
            lblStatus.ForeColor = &HC0C0C0
        Else
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = ""
            lblStatus.Caption = ""
            lblStatus.ForeColor = &HC0C0C0
        End If
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtSONo.Locked = False
    End If
    
    If Mode = AddNewEdit Then dtgSO.Refresh
    
ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else: SSTab1.TabEnabled(1) = True
    End If
End Sub

Private Sub txtType_Change()
Dim sCode As String
    If Trim(txtType) <> "" Or txtType <> vbNullString Then
    Else: cboType.ListIndex = -1
    End If
End Sub

Private Sub txtCode_Change()
On Error Resume Next
    txtName = ""
    txtName = GetValueFrTable("cName", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
    
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtName) <> "" Then
        rsHeader!cDelCode = txtCode
        rsHeader!cAddress = GetAddress("CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'") & ""
        rsHeader!cContact = GetValueFrTable("cContact", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cMSCode = GetValueFrTable("cMSCode", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cSMan = GetValueFrTable("cSMan", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cTerm = GetValueFrTable("cTerm", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cIntTerm = GetValueFrTable("cIntTerm", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        rsHeader!cTaxType = GetValueFrTable("cTaxType", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtCode) & "'")
        txtAddress.SetFocus
    Else
        txtDelCode = ""
        txtAddress = ""
        txtContact = ""
        txtMSCode = ""
        txtSMCode = ""
        cboTerms.ListIndex = -1
        cboIntTerms.ListIndex = -1
    End If
End Sub

Private Sub txtCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtName) = "" And Trim(txtCode) <> "" Then cmdPickCode_Click
End Sub

Private Sub txtCPONo_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SSTab2.ActiveTab = 2
    End If
End Sub

Private Sub txtCurrency_Change()
    If Trim(txtCurrency) <> "" Or txtCurrency <> vbNullString Then
'        cboCurrency = Trim(txtCurrency)
    Else
        cboCurrency.ListIndex = -1
    End If
End Sub

Private Sub txtDelCode_Change()
On Error Resume Next
    txtDelName = ""
    txtDelName = GetValueFrTable("cName", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
    If Trim(txtDelName) <> "" Then
        txtDelAddress = GetAddress("CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'") '+ ", " + GetValueFrTable("cCity", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
        txtDelContact = GetValueFrTable("cContact", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
        txtPhone1 = GetValueFrTable("cTel1", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
        txtFax = GetValueFrTable("cFax", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
        txtEMail1 = GetValueFrTable("cEMail1", "CLIENT_CUSTOMER", "cCode = '" & Trim(txtDelCode) & "'")
    Else
        txtDelAddress = ""
        txtDelContact = ""
        txtPhone1 = ""
        txtFax = ""
        txtEMail1 = ""
    End If
    
    If Mode <> AddNewEdit Then Exit Sub
End Sub

Private Sub txtDelCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtDelName) = "" And Trim(txtDelCode) <> "" Then cmdPickDelCode_Click
End Sub

Private Sub txtDelContact_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SSTab2.ActiveTab = 3
    End If
End Sub

Private Sub txtDiscount_Change()
    ComputeTotal
End Sub

Private Sub txtLongDesc_KeyPress(KeyAscii As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtLongDesc_LostFocus()
    txtLongDesc.Visible = False
    dtgSO.Col = 4
    dtgSO.SetFocus
End Sub

Private Sub txtMSCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtMSDesc) = "" And Trim(txtMSCode) <> "" Then cmdPickMS_Click
End Sub

Private Sub txtPaymentType_Change()
    If Trim(txtPaymentType) <> "" Or txtPaymentType <> vbNullString Then
        cboPaymentType = Trim(txtPaymentType)
    Else: cboPaymentType.ListIndex = -1
    End If
End Sub

Private Sub txtTaxType_Change()
    If Trim(txtTaxType) <> "" Or txtTaxType <> vbNullString Then
        cboTaxType.Text = Trim(txtTaxType)
        If Trim(txtTaxType) = "VAT" Then
            txtVatRATE.Text = GetValueFrTable("cValue", "System_Option", "cCode = 'DEF_VAT_RATE'")
        Else: txtVatRATE.Text = 0
        End If
    Else: cboTaxType.ListIndex = -1
    End If
End Sub

Private Sub txtSMCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtSMName) = "" And Trim(txtSMCode) <> "" Then cmdPickSM_Click
End Sub

Private Sub txtSONo_LostFocus()
    'Does Code Already exists
    If Mode = AddNewEdit Then
    
        If Trim(txtSONo) = "" Then
            MsgBox "Empty primary input.", vbInformation, msgTtl
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtSONo.SetFocus
            Exit Sub
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtSONo = Trim(txtSONo)
            If IDExisting(rsHeader, "cSONo", "SO", Trim(rsHeader!cSONO), "cType <> 'EXPORT'") Then
                MsgBox "Sales order No. already exists.", vbInformation, msgTtl
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtSONo.SetFocus
                Exit Sub
            End If
        End If
    End If
End Sub

Private Sub txtIntTerms_Change()
    If Trim(txtIntTerms) <> "" Or txtIntTerms <> vbNullString Then
        cboIntTerms = Trim(txtIntTerms)
    Else: cboIntTerms.ListIndex = -1
    End If
End Sub

Private Sub txtMSCode_Change()
    txtMSDesc = ""
    txtMSDesc = GetValueFrTable("cDescription", "CLASSIFICATION", "cClassCode = '" & Trim(txtMSCode) & "' AND cType = 'MS'")
End Sub

Private Sub txtSMCode_Change()
    txtSMName = ""
    txtSMName = GetValueFrTable("cName", "SALESMAN", "cCode = '" & Trim(txtSMCode) & "'")
End Sub

Private Sub txtTerms_Change()
    If Trim(txtTerms) <> "" Or txtTerms <> vbNullString Then
        cboTerms.Text = Trim(txtTerms.Text)
    Else: cboTerms.ListIndex = -1
    End If
End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean
On Error GoTo ErrorHandler
    MandatoryOK = True
    
    If Trim(txtSONo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Order Number' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtSONo.SetFocus
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew And lSystemGeneratedSO = False Then
        If IDExisting(rsHeader, "cSONo", "SO", Trim(rsHeader!cSONO), "cType <> 'EXPORT'") Then
            MandatoryOK = False
            MsgBox "Sales order No. already exists.", vbInformation, msgTtl
            txtSONo.SetFocus
            Exit Function
        End If
    End If
        
    'Required fields
    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Order Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(txtType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Order Type' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboType.SetFocus
        Exit Function
    ElseIf Trim(txtCode) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Customer' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtCode.SetFocus
        Exit Function
    ElseIf Trim(txtDelCode) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Delivery Customer' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtDelCode.SetFocus
        Exit Function
    ElseIf Trim(txtSMCode) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Salesman' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtSMCode.SetFocus
        SSTab2.ActiveTab = 0
        Exit Function
    ElseIf Trim(txtIntTerms) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Internal Terms' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboIntTerms.SetFocus
        Exit Function
    ElseIf Trim(txtTerms) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Actual Terms' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboTerms.SetFocus
        Exit Function
    ElseIf Trim(txtPaymentType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Payment Type' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboPaymentType.SetFocus
        Exit Function
    ElseIf Trim(txtTaxType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Tax Type' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        cboPaymentType.SetFocus
        Exit Function
    End If
    
    GetChild
    
    'Transaction without details
    If rsDetail.RecordCount = 0 Then
        MandatoryOK = False
        MsgBox "Cannot save transaction without details.", vbInformation, msgTtl
        dtgSO.SetFocus
        Exit Function
    End If
        
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
    'code by gino: To validate the quantity of the product
        If rsDetail!nQty = 0 Then
                MandatoryOK = False
                MsgBox "Quantity' is mandatory. Null/Zero value is not allowed.", vbInformation, msgTtl
                dtgSO.SetFocus
                Exit Function
        End If
    
        If Trim(cboType) = "For Consignment" Then rsDetail!lDRReady = True
        If Trim(cboType) = "For Sales-Con" Then rsDetail!lDRReady = True
        If Trim(rsDetail!cStatus) = "Available" Then rsDetail!lDRReady = True
        If lAutoStock Then rsDetail!lDRReady = True
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cItemNo) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cItemNo) = "" Then
                rsDetail.Delete
            Else: rsDetail.MoveNext
            End If
        Else: rsDetail.MoveNext
        End If
    Loop
    
    ' Added by Myk 08-01-2011
    ' Start
    GetChild
    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    ' End
    ' Added by Myk 08-01-2011
    
    GetChild
    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If
    
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!nIdentity = rsDetail.AbsolutePosition
            rsDetail.MoveNext
        Loop
    End If
    
    If (Trim(cboType) = "For Consignment") Or (Trim(cboType) = "For Sales-Con") Then
        rsHeader!lCApproved = True
        rsHeader!lPApproved = True
    End If
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
        MsgBox "Cannot save transaction, please refresh data!", vbExclamation, msgTtl
    End If
End Function

'Filter detail recordset to header's primary
Private Sub GetChild()
    rsDetail.Filter = "cSONo = '" & Trim(rsHeader!cSONO) & "'"
End Sub

'Sets the form if record number is zero
Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgSO.DataSource = Nothing
    dtgSO.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsDetail.State = adStateOpen Then rsDetail.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtSONo.Locked = False
    txtSONo.SetFocus
    
    Mode = Find
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
    cboType.Enabled = lEnable
    cmdPickCode.Enabled = lEnable
    cmdPickSM.Enabled = lEnable
    cboIntTerms.Enabled = lEnable
    cboTerms.Enabled = lEnable
    cboPaymentType.Enabled = lEnable
    cmdPickMS.Enabled = lEnable
    cboCurrency.Enabled = lEnable
    dtgExpiration.Enabled = lEnable
    cmdPickDelCode.Enabled = lEnable
    cboTaxType.Enabled = lEnable
End Sub

'Gets initital item values
Private Sub GetInitialItemValues()
On Error GoTo ErrorHandler
Dim xPM As String
    rsDetail!cLongDesc = Trim(GetValueFrTable("cDesc", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) & ""
    rsDetail!cUnit = Trim(GetValueFrTable("cUnit", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) & ""
    rsDetail!cPricing = "SRP"
    rsDetail!nPrice = Trim(GetValueFrTable("nSRPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) & ""
    rsDetail!nNetPrice = rsDetail!nPrice
    rsDetail!cWH = Trim(GetValueFrTable("cWh", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) & ""
    xPM = GetValueFrTable("cPMID", "Client_Customer", "cCode = '" & Trim(rsHeader!cCode) & "'")
    If xPM <> "" Then
        Select Case GetValueFrTable("cType", "PM", "cPMID = '" & Trim(xPM) & "'")
            Case "Market Segment"
                rsDetail!cPricing = "Pricing MS"
                If Me.txtMSCode <> GetValueFrTable("cReference", "PM", "cPMID = '" & Trim(xPM) & "'") Then Exit Sub
                rsDetail!cUnit = GetValueFrTable("cUnit", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!nPrice = GetValueFrTable("nPrice", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!cDiscount = GetValueFrTable("cDiscount", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
            Case "Customer"
                rsDetail!cPricing = "Pricing Client"
                rsDetail!cUnit = GetValueFrTable("cUnit", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!nPrice = GetValueFrTable("nPrice", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!cDiscount = GetValueFrTable("cDiscount", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
            Case "Terms"
                rsDetail!cPricing = "Pricing Terms"
                If Me.txtIntTerms <> GetValueFrTable("cReference", "PM", "cPMID = '" & Trim(xPM) & "'") Then Exit Sub
                rsDetail!cUnit = GetValueFrTable("cUnit", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!nPrice = GetValueFrTable("nPrice", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
                rsDetail!cDiscount = GetValueFrTable("cDiscount", "PM_T", "cPMID = '" & Trim(xPM) & "' and cItemNo = '" & Trim(rsDetail!cItemNo) & "'")
            Case "Area"
        
        End Select
    rsDetail!nFactor = GetValueFrTable("nFactor", "ITEM_Unit", "cItemNo = '" & Trim(rsDetail!cItemNo) & "' and cUnit = '" & Trim(rsDetail!cUnit) & "'")
    End If
    
    Dim rsBal As New ADODB.Recordset
    
    sSQL = "exec SP_ProductBalanceInquiry_Module '" & rsDetail!cItemNo & "', '" & COID & "'"        ''" & sBarcodeID & "',
    rsBal.Open sSQL, cn, adOpenStatic, adLockOptimistic
    If rsBal.RecordCount > 0 Then
        If rsBal!nBalance <= 0 Then
            rsDetail!cStatus = "No Stock"
            rsDetail!nQty = 0
        Else
            rsDetail!cStatus = "Available"
            rsDetail!nQty = 0
        End If
    Else
        rsDetail!cStatus = "Available"
        rsDetail!nQty = 0
    End If
    rsBal.Close
    Set rsBal = Nothing
    
    Select Case UCase(Trim(GetValueFrTable("cType", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")))
        Case "ASSEMBLY"
            If rsDetail!cStatus = "No Stock" Then rsDetail!cStatus = "Production"
        Case "BUY-OUT"
            If rsDetail!cStatus = "No Stock" Then rsDetail!cStatus = "Buy-out"
    End Select
    
    aQty(rsDetail.AbsolutePosition) = rsDetail!nQty
    
    ComputeTotalDisc
    ComputeAmount
    ComputeTotal
ErrorHandler:
    If err.Number <> 0 And err.Number <> -2147217908 Then
        MsgBox err.Description, vbInformation, msgTtl
    Else
        rsDetail!cStatus = "Available"
        rsDetail!cStatus = "Available"
        rsDetail!nQty = 0
        Select Case UCase(Trim(GetValueFrTable("cType", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")))
            Case "ASSEMBLY"
                If rsDetail!cStatus = "No Stock" Then rsDetail!cStatus = "Production"
            Case "BUY-OUT"
                If rsDetail!cStatus = "No Stock" Then rsDetail!cStatus = "Buy-out"
        End Select
        
        aQty(rsDetail.AbsolutePosition) = rsDetail!nQty
        
        ComputeTotalDisc
        ComputeAmount
        ComputeTotal
    End If
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtSONo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cSONo LIKE '" & Trim$(txtSONo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(cboType) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cType = '" & Trim$(cboType) & "'"
    End If
    
    If Trim$(txtCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCode LIKE '" & Trim$(txtCode.Text) & "%'"
    End If
    
    If Trim$(txtSMCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cSMan LIKE '" & Trim$(txtSMCode.Text) & "%'"
    End If
    
    If Trim$(txtIntTerms.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cIntTerm LIKE '" & Trim$(txtIntTerms.Text) & "%'"
    End If
    
    If Trim(txtTerms.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTerm LIKE '" & Trim$(txtTerms.Text) & "%'"
    If Trim(txtPaymentType.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cPayType LIKE '" & Trim$(txtPaymentType.Text) & "%'"
    If Trim(txtMSCode.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cMSCode LIKE '" & Trim$(txtMSCode.Text) & "%'"
    If Trim(txtCurrency.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCurrency LIKE '" & Trim$(txtCurrency.Text) & "%'"
    If Trim(dtgExpiration.Text) <> "__/__/____" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dExpiration = '" & Trim$(dtgExpiration.Text) & "'"
    If Trim(txtCPONo.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCPONo LIKE '" & Trim$(txtCPONo.Text) & "%'"
    If Trim(txtDelCode.Text) <> "" Then sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cDelCode LIKE '" & Trim$(txtDelCode.Text) & "%'"
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

'Computes multi-level discount
Private Sub ComputeNet()
Dim si, l As Integer
Dim s(0 To 15), ns, disc As String
Dim lStop As Boolean
On Error GoTo ErrHandler
    
    lNetOK = True
    
    If rsDetail.RecordCount = 0 Then Exit Sub
    If IsNull(rsDetail!cItemNo) Then Exit Sub
    If Trim(rsDetail!cItemNo) = "" Then Exit Sub
    
    lNetOK = False
    
    rsDetail!cDiscount = Trim(dtgSO.Columns(7).Text)
    disc = rsDetail!cDiscount
    net = dtgSO.Columns(6).Value 'rsDetail!nPrice  'dtgSO.Columns(6).Value
    
    If disc <> "" Then
        l = Len(disc)
        i = 1
        si = 0
        Do While Not i = l + 1
            cString = Mid(disc, i, 1)
            If cString <> "/" Then
                ns = ns + cString
                s(si) = ns
            Else: si = si + 1
                ns = ""
            End If
            i = i + 1
        Loop
                
        si = 0
        lStop = False
        
        Do While Not lStop
            If s(si) <> "" Then
                If Not IsNumeric(s(si)) Then GoTo ErrHandler
                si = si + 1
            Else: lStop = True
            End If
        Loop
        
        si = 0
        lStop = False
        
        Do While Not lStop
            If s(si) <> "" Then
                If Right(s(si), 1) = "-" Then GoTo ErrHandler
                If (Mid(s(si), 1, 1) = "-") Then
                    net = net + CDbl(s(si))
                Else: net = net - (net * (CDbl(s(si)) * 0.01))
                End If
                si = si + 1
            Else: lStop = True
            End If
        Loop
    
    End If
    
    If s(0) = "" Then rsDetail!cDiscount = ""
    
    rsDetail!nNetPrice = net 'Round(net, 4)
    lNetOK = True
    
ErrHandler:
    If Not lNetOK Then
        MsgBox "Invalid discount format! (ex: '10/5/-100', '-100/10/5', '10/-100/5')", vbCritical, msgTtl
        lLessAmount = False
        lLessPercent = False
    End If

End Sub


'Computes total amount per detail line
Private Sub ComputeAmount()
On Error Resume Next
Dim nAmount As Double
    If Mode <> AddNewEdit Then Exit Sub

        nAmount = IIf(IsNull(rsDetail!nNetPrice), 0, rsDetail!nNetPrice) * IIf(IsNull(rsDetail!nQty), 0, rsDetail!nQty)
        rsDetail!nAmount = Round(net, 4) * CDec(IIf(IsNull(rsDetail!nQty), 0, rsDetail!nQty))
        
End Sub
'Computes total amount of order
Public Sub ComputeTotal()
Dim m, n As Double
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub
    n = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cSONo = '" & Trim(rsHeader!cSONO) & "'"
    
    rs.MoveFirst
    Do Until rs.EOF
        n = n + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        rs.MoveNext
        Loop
    Set rs = Nothing
    
    If Mode <> AddNewEdit Then Exit Sub
    
    n = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cSONo = '" & Trim(rsHeader!cSONO) & "'"
    
    rs.MoveFirst
    Do Until rs.EOF
        n = n + IIf(IsNull(rs!nAmount), 0, rs!nAmount)
        rs.MoveNext
        Loop
    Set rs = Nothing
    
    If chkVATType.Value Then
        m = n * (1 - (1 / (1 + txtVatRATE / 100)))
    Else: m = n * (txtVatRATE / 100)
    End If
    n = n
    
    With rsHeader
        !nTotalAmount = IIf(chkVATType.Value, Round(n, 2) - Round(m, 2), Round(n, 2))
        !nVatAmount = Round(m, 2)
        !nNet = IIf(chkVATType.Value, Round(n, 2), Round(n, 2) + Round(m, 2))
    End With
End Sub

Public Sub ComputeTotalDisc()
Dim n As Double
On Error Resume Next
    If Mode <> AddNewEdit Then Exit Sub
    n = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cSONo = '" & Trim(rsHeader!cSONO) & "'"

    rs.MoveFirst
    Do Until rs.EOF
        If IsNull(rs!cDiscount) Or rs!cDiscount = "" Then
        n = 0
        Else
        n = n + ((IIf(IsNull(rs!nPrice), 0, rs!nPrice) - IIf(IsNull(rs!nNetPrice), 0, rs!nNetPrice)) * IIf(IsNull(rs!nQty), 0, rs!nQty))
        End If
        rs.MoveNext
    Loop
    Set rs = Nothing
    
    rsHeader!nDiscount = IIf(chkVATType.Value, ((n) / (1 + txtVatRATE / 100)), n)

End Sub

Private Function AllowEdit() As Boolean
    AllowEdit = True
    'Cannot edit if transaction was already approved
    If rsHeader!lCApproved = True Then
        MsgBox "Cannot edit approved transaction.", vbCritical + vbExclamation, msgTtl
        AllowEdit = False
        Exit Function
    End If
End Function

Private Function AllowDelete(sAction As String) As Boolean
    AllowDelete = True
    
    If sAction <> "cancel" Then
        'Cannot delete if transaction was already approved
        If rsHeader!lCApproved = True Then
            MsgBox "Cannot " & sAction & " approved transaction.", vbCritical + vbExclamation, msgTtl
            AllowDelete = False
            Exit Function
        End If
    Else
        If GetValueFrTable("cSONo", "V_SOTransactions", "cSONo = '" & Trim(txtSONo) & "'") <> "" Then
            MsgBox "Cannot " & sAction & " referenced SO transaction.", vbCritical + vbExclamation, msgTtl
            AllowDelete = False
            Exit Function
        End If
    End If

End Function

'Change Transaction Number
Sub ChangeTranNo(strTranNo As String)
    GetChild
    
    rsHeader!cSONO = strTranNo
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        rsDetail!cSONO = strTranNo
        rsDetail.MoveNext
    Loop
    
    GetChild
End Sub

Private Sub GetRWMPrice()
    Select Case Trim(rsDetail!cPricing)
        Case "SRP"
            rsDetail!nPrice = IIf(GetValueFrTable("nSRPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") = Null, 0, GetValueFrTable("nSRPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) '* rsDetail!nFactor
        Case "Regular"
            rsDetail!nPrice = IIf(GetValueFrTable("nSRPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") = Null, 0, GetValueFrTable("nSRPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) '* rsDetail!nFactor
        Case "WSP"
            rsDetail!nPrice = IIf(GetValueFrTable("nWSPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'") = Null, 0, GetValueFrTable("nWSPrice", "ITEM", "cItemNo = '" & Trim(rsDetail!cItemNo) & "'")) '* rsDetail!nFactor
        Case "Pricing MS"
            rsDetail!nPrice = 0
        Case "Pricing Terms"
            rsDetail!nPrice = 0
        Case "Pricing Client"
            rsDetail!nPrice = 0
        Case "FOC"
            rsDetail!nPrice = 0
        Case "Others"
            rsDetail!nPrice = 0
    End Select
    rsDetail!nNetPrice = rsDetail!nPrice
    ComputeTotalDisc
    ComputeAmount
    ComputeTotal
End Sub

Private Sub txtVATRate_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    ComputeTotal
End Sub

Private Sub txtVATRate_Change()
    If Mode <> AddNewEdit Then Exit Sub
    ComputeTotal
End Sub

Public Sub ShowTran()
On Error GoTo ErrorHandler
    If Mode = Find Then

        OpenNewConnection connHeader
        OpenNewConnection connDetail

        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset

        OpenRecordsetWithCN rsDetail, "*", "SO_T", connDetail, "WHERE cSONo = '" & Trim(txtSONo) & "'", True
        OpenRecordsetWithCN rsHeader, "*", "SO", connHeader, "WHERE cSONo = '" & Trim(txtSONo) & "'", True

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtSONo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , True, , , , True, , , True
'            oBar.BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True

    End If
ErrorHandler:
    If err.Number <> 0 Then
        MsgBox err.Description, vbInformation, msgTtl
    End If
End Sub


